
class SpecialChar:
    def __init__(self):
        pass

    def __str__(self):
        return "Special char : \ , = [ ] { }"

    @classmethod
    def is_alpha(cls, char):
        return (((ord('A') <= char) and (char <= ord('Z'))) or ((ord('a') <= char) and (char <= ord('z'))))

    @classmethod
    def is_digit(cls, char):
        return (ord('0') <= char) and (char <= ord('9'))

    @classmethod
    def is_slash(cls, char):
        return char == ord('\\')

    @classmethod
    def is_pair_separator(cls, char):
        return char == ord(',')

    @classmethod
    def is_kv_separator(cls, char):
        return char == ord('=')

    @classmethod
    def is_array_begin(cls, char):
        return char == ord('[')

    @classmethod
    def is_array_end(cls, char):
        return char == ord(']')

    @classmethod
    def is_object_begin(cls, char):
        return char == ord('{')

    @classmethod
    def is_object_end(cls, char):
        return char == ord('}')

    @classmethod
    def is_string_end(cls, char):
        return cls.is_object_end(char) or cls.is_pair_separator(char) or cls.is_array_end(char)

    @classmethod
    def is_escape(cls, char):
        return cls.is_slash(char) or cls.is_pair_separator(char) or cls.is_kv_separator(char) \
            or cls.is_array_begin(char) or cls.is_array_begin(char) \
            or cls.is_object_begin(char) or cls.is_object_end(char)

    @classmethod
    def is_not_escape(cls, char):
        return  (not cls.is_escape(char))


import unittest
class TestSpecialChar(unittest.TestCase):
    str_bytes = b'a6,=\\[]{}'
    def test_alpha(self):
        self.assertTrue(SpecialChar.is_alpha(self.str_bytes[0]))

    def test_digit(self):
        self.assertTrue(SpecialChar.is_digit(self.str_bytes[1]))

    def test_pair_sep(self):
        self.assertTrue(SpecialChar.is_pair_separator(self.str_bytes[2]))

    def test_kv_pair(self):
        self.assertTrue(SpecialChar.is_kv_separator(self.str_bytes[3]))

    def test_slash(self):
        self.assertTrue(SpecialChar.is_slash(self.str_bytes[4]))

    def test_array_char(self):
        self.assertTrue(SpecialChar.is_array_begin(self.str_bytes[5]))
        self.assertTrue(SpecialChar.is_array_end(self.str_bytes[6]))

    def test_object_char(self):
        self.assertTrue(SpecialChar.is_object_begin(self.str_bytes[7]))
        self.assertTrue(SpecialChar.is_object_end(self.str_bytes[8]))


if __name__ == '__main__':
    unittest.main(verbosity=2)
